package io.cici.cc.mybatis.lite.sql_source;

import io.cici.cc.mybatis.lite.mapping.ParameterMapping;
import io.cici.cc.mybatis.lite.mapping.Sql;
import io.cici.cc.mybatis.lite.mapping.SqlSource;
import io.cici.cc.mybatis.lite.session.Configuration;

import java.util.List;

/**
 * @author huihui
 */
public class StaticSqlSource implements SqlSource {
    private final Configuration configuration;
    private final String sql;
    private final List<ParameterMapping> parameterMappingList;


    public StaticSqlSource(Configuration configuration, String sql) {
        this(configuration, sql, null);
    }

    public StaticSqlSource(Configuration configuration, String sql, List<ParameterMapping> parameterMappingList) {
        this.configuration = configuration;
        this.sql = sql;
        this.parameterMappingList = parameterMappingList;
    }

    @Override
    public Sql getSql(Object parameterObject) {
        return new Sql(configuration, sql, parameterMappingList, parameterObject);
    }

}
